#ifndef __ARDUINO_H__
#define __ARDUINO_H__
#include "IArduino.h"
#include "Arduino.h"
#include "MallocFix.h"
class IService;

class ArduinoHW : public IArduino{
public:
	virtual int dRead(int pin){
		digitalRead(pin);
	}
	virtual void dWrite(int pin, int value){
		digitalWrite(pin, value);
	}
	virtual int HIGHVAL(){
		return HIGH;
	}
	virtual int LOWVAL(){
		return LOW;
	}
	virtual int OUT(){
		return OUTPUT;
	}
	virtual int IN(){
		return INPUT;
	}
	virtual void pin(int ledPin, int mode){
		pinMode(ledPin, mode);
	}
	virtual long milliseconds(){
		return millis	();
	}
	virtual void reset(){
		//void setup(){
		//digitalWrite(7, HIGH); //We need to set it HIGH immediately on boot
		//pinMode(7,OUTPUT);     //We can declare it an output ONLY AFTER it's HIGH
		// (( HACKHACKHACKHACK ))
		//	digitalWrite(7, LOW);
	}
	virtual int availableMem(){
		int size = 8000;
		byte *buf;
		while ((buf = (byte *) malloc(size-=10)) == 0);
		free(buf);
		fix28135_malloc_bug();
		return size;
	}
};

#endif